//
//  YSNavigationController.swift
//  YunshuApp
//
//  Created by 周文杰 on 2017/6/9.
//  Copyright © 2017年 zwj. All rights reserved.
//

import UIKit

class YSNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        super.pushViewController(viewController, animated: true)
        let leftBtn = UIBarButtonItem.init(image: UIImage.init(named: "back"), style: .plain, target: self, action: #selector(YSNavigationController.popTopVC))
        viewController.navigationItem.leftBarButtonItem = leftBtn
    }

    @objc func popTopVC() {
        self.popViewController(animated: true)
    }
}
